package com.egreen.asset.controller;


import com.egreen.asset.service.IOperateBalanceRecordingService;
import com.egreen.common.Result;
import com.egreen.common.pojo.VO.asset.OperateBalanceRecordingVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author cloudJiang
 * @since 2022-07-16
 */
@RestController
@RequestMapping("/operateBalanceRecording")
public class OperateBalanceRecordingController {
    @Autowired
    IOperateBalanceRecordingService operateBalanceRecordingService;

//    /**
//     * 余额增加与减少(从前端传过来修改数据)
//     *
//     * @param operateBalanceRecordingDTO
//     */
//    @ApiOperation(value = "操作账户余额",notes = "通过调用updateByBalance方法，来更新账户余额")
//    @PostMapping("/updateBalance")
//    public Result updateBalance(@RequestBody OperateBalanceRecordingDTO operateBalanceRecordingDTO) {
//        operateBalanceRecordingService.updateByBalance(operateBalanceRecordingDTO);
//        return Result.OK();
//    }

    /**
     * 余额交易明细查看(需要从前端传过来id来显示其交易记录)
     * get请求注解用@PathVariable 传值在url上显示
     *
     * @param balanceAccountId
     * @return
     */
    @ApiOperation(value = "查看余额账户明细",notes = "查看余额账户明细")
    @GetMapping("/balanceRecording/{balanceAccountId}")
    public Result balanceRecording(@PathVariable Long balanceAccountId) {
        List<OperateBalanceRecordingVO> operateBalanceRecordingVOS = operateBalanceRecordingService.selectBalanceById(balanceAccountId);
        return Result.OK(operateBalanceRecordingVOS);

    }

}

